package com.yy.personalcv.service.impl;

import com.yy.personalcv.mapper.SkillMapper;
import com.yy.personalcv.pojo.Skill;
import com.yy.personalcv.service.SkillService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class SkillServiceImpl implements SkillService {

    @Resource
    private SkillMapper skillMapper;

    @Override
    public Skill getSkillDetail(int id, int uid) {
        return skillMapper.getSkillDetail(id, uid);
    }

    @Override
    public int getSkillCounts(int uid) {
        return skillMapper.getSkillCounts(uid);
    }

    @Override
    public List<Skill> selectTen(Map map) {
        return skillMapper.selectTen(map);
    }

    @Override
    public void addSkill(Skill skill) {
        skill.setDisplay(1);
        skill.setModified(new Date());
        skillMapper.addSkill(skill);
    }

    @Override
    public void deleteSkill(int id, int uid) {
        skillMapper.deleteSkill(id,uid);
    }

    @Override
    public List<Skill> selectAll(int uid) {
        return skillMapper.selectAll(uid);
    }

    @Override
    public void editSkill(Skill skill) {
        skill.setModified(new Date());
        skillMapper.editSkill(skill);
    }
}
